bootstrap.php

+-----------------------------------------------------------------------+ | This file is part of the Roundcube webmail client | | | | Copyright (C) The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | | See the README file for a full license statement. | | | | CONTENTS: | | Roundcube Framework Initialization | +-----------------------------------------------------------------------+ | Author: Thomas Bruederli <roundcube@gmail.com> | | Author: Aleksander Machniak <alec@alec.pl> | +-----------------------------------------------------------------------+

Constants

RCUBE_VERSION

RCUBE_VERSION = '1.5.2'

RCUBE_CHARSET

RCUBE_CHARSET = 'UTF-8'

RCUBE_TEMP_FILE_PREFIX

RCUBE_TEMP_FILE_PREFIX = 'RCMTEMP'

RCUBE_LIB_DIR

RCUBE_LIB_DIR = __DIR__ . '/'

RCUBE_INSTALL_PATH

RCUBE_INSTALL_PATH = \RCUBE_LIB_DIR

RCUBE_CONFIG_DIR

RCUBE_CONFIG_DIR = \RCUBE_INSTALL_PATH . 'config/'

RCUBE_PLUGINS_DIR

RCUBE_PLUGINS_DIR = \RCUBE_INSTALL_PATH . 'plugins/'

RCUBE_LOCALIZATION_DIR

RCUBE_LOCALIZATION_DIR = \RCUBE_INSTALL_PATH . 'localization/'

Functions

in_array_nocase()

in_array_nocase(string  $needle, mixed  $haystack) : bool

Similar function as in_array() but case-insensitive with multibyte support.

Parameters

string $needle

Needle value

mixed $haystack

Returns

bool —

True if found, False if not

parse_bytes()

parse_bytes(string  $str) : float

Parse a human readable string for a number of bytes.

Parameters

string $str

Input string

Returns

float —

Number of bytes

slashify()

slashify(string  $str) : string

Make sure the string ends with a slash

Parameters

string $str

A string

Returns

string —

A string ending with a slash

unslashify()

unslashify(string  $str) : string

Remove slashes at the end of the string

Parameters

string $str

A string

Returns

string —

A string ending with no slash

get_offset_sec()

get_offset_sec(string  $str) : int

Returns number of seconds for a specified offset string.

Parameters

string $str

String representation of the offset (e.g. 20min, 5h, 2days, 1week)

Returns

int —

Number of seconds

get_offset_time()

get_offset_time(string  $offset_str, int  $factor = 1) : int

Create a unix timestamp with a specified offset from now.

Parameters

string $offset_str

String representation of the offset (e.g. 20min, 5h, 2days)

int $factor

Factor to multiply with the offset

Returns

int —

Unix timestamp

abbreviate_string()

abbreviate_string(string  $str, int  $maxlength, string  $placeholder = '...', bool  $ending = false) : string

Truncate string if it is longer than the allowed length.

Replace the middle or the ending part of a string with a placeholder.

Parameters

string $str

Input string

int $maxlength

Max. length

string $placeholder

Replace removed chars with this

bool $ending

Set to True if string should be truncated from the end

Returns

string —

Abbreviated string

array_keys_recursive()

array_keys_recursive(array  $array) : array

Get all keys from array (recursive).

Parameters

array $array

Input array

Returns

array —

List of array keys

array_first()

array_first(array  $array) : mixed

Get first element from an array

Parameters

array $array

Input array

Returns

mixed —

First element if found, Null otherwise

asciiwords()

asciiwords(string  $str, bool  $css_id = false, string  $replace_with = '') : string

Remove all non-ascii and non-word chars except ., -, _

Parameters

string $str

A string

bool $css_id

The result may be used as CSS identifier

string $replace_with

Replacement character

Returns

string —

Clean string

is_ascii()

is_ascii(string  $str, bool  $control_chars = true) : bool

Check if a string contains only ascii characters

Parameters

string $str

String to check

bool $control_chars

Includes control characters

Returns

bool —

True if the string contains ASCII-only, False otherwise

format_email_recipient()

format_email_recipient(string  $email, string  $name = '') : string

Compose a valid representation of name and e-mail address

Parameters

string $email

E-mail address

string $name

Person name

Returns

string —

Formatted string

format_email()

format_email(string  $email) : string

Format e-mail address

Parameters

string $email

E-mail address

Returns

string —

Formatted e-mail address

version_parse()

version_parse(string  $version) : mixed

Fix version number so it can be used correctly in version_compare()

Parameters

string $version

Version number string

Returns

mixed —

rcube_autoload()

rcube_autoload(string  $classname) : bool

Use PHP5 autoload for dynamic class loading

Parameters

string $classname

Class name

Returns

bool —

True when the class file has been found